package com.koron.rating.rating.mapper;

import com.koron.rating.external.bean.CensusBo;
import com.koron.rating.external.bean.GcxxhVo;
import com.koron.rating.rating.bean.RatingOrderBean;
import com.koron.rating.rating.bean.RatingOrderDto;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @Author: rocky
 * @Date: 2022/1/11 9:45
*/
public interface RatingOrderMapper {
    int deleteByPrimaryKey(String id);

    int insert(RatingOrderBean record);

    int insertOrUpdate(RatingOrderBean record);

    int insertOrUpdateSelective(RatingOrderBean record);

    int insertSelective(RatingOrderBean record);

    RatingOrderBean selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(RatingOrderBean record);

    int updateByPrimaryKey(RatingOrderBean record);

    List<RatingOrderDto> queryByAll(RatingOrderDto querybean);

    /**
     * 找相应部门上次的评级单
     * @param maxRatingTime
     * @return
     */
    List<RatingOrderBean> queryByRatingTimeBefore(@Param("maxRatingTime")Date maxRatingTime, @Param("deptId") String deptId, @Param("id") String id);


    /**
     * 更新评级结束状态
     * @param updatedRatingStatus
     * @param updatedRatingTime
     * @param updatedRatingYear
     * @param id
     * @return
     */
    int updateEndStatus(@Param("updatedRatingStatus")String updatedRatingStatus, @Param("updatedRatingTime")Date updatedRatingTime, @Param("updatedRatingYear")Integer updatedRatingYear, @Param("id")String id);

    // 统计个部分评级设备数量
    List<CensusBo> censusTotalQty(@Param("year") Integer year);

    // 按年份类型统计数量
    List<GcxxhVo> censusGroupGren(@Param("year") Integer year);


    int updateById(RatingOrderBean record);

}
